package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.Classinfo;
import cn.wolfcode.crm.mapper.ClassinfoMapper;
import cn.wolfcode.crm.qo.ClassinfoQuery;
import cn.wolfcode.crm.service.IClassinfoService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassinfoServiceimpl implements IClassinfoService {

    @Autowired
    private ClassinfoMapper classinfoMapper;

    @Override
    public void save(Classinfo classinfo) {
        classinfoMapper.insert(classinfo);
    }

    @Override
    public void deleteByPrimaryKey(Long id) {

        classinfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void updateByPrimaryKey(Classinfo classinfo) {

        classinfoMapper.updateByPrimaryKey(classinfo);

    }

    @Override
    public Classinfo get(Long id) {
        return classinfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Classinfo> selectAll() {
        return classinfoMapper.selectAll();
    }

    @Override
    public PageInfo query(ClassinfoQuery qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Classinfo> list = classinfoMapper.queryForList(qo);
        //返回的是PageInfo
        return new PageInfo(list);

    }



}
